package com.myown.algorithm;

/**
 * 石油管道问题 <p>
 *
 * @author lincky
 * @version v1.0.0
 * @time 2017/2/11 15:19
 */

public class OilTunnel {

    /**
     * 管道
     */
    static class Tunnel {
        int x;
        int y;

        public Tunnel(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

    /**
     * 两点之间距离
     *
     * @param tunnelA tunnelA
     * @param tunnelB tunnelB
     * @return 距离
     */
    private static double distance(Tunnel tunnelA,
                                   Tunnel tunnelB) {
        return distance(tunnelA.x, tunnelA.y,
                tunnelB.x, tunnelB.y);
    }

    /**
     * 两点之间距离
     *
     * @param x1 x1
     * @param y1 y1
     * @param x2 x2
     * @param y2 y2
     * @return 距离
     */
    private static double distance(int x1,
                                  int y1,
                                  int x2,
                                  int y2) {
        return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
    }



    public static void main(String[] args) {
        System.out.println(distance(0, 3, 4, 0));
    }

}
